Skip to content

[worker] warn on unknown build environment#3952

Open
gwdp wants to merge 1 commit into
mainfrom
gwdp/warn-unknown-build-environment
Open

[worker] warn on unknown build environment#3952
gwdp wants to merge 1 commit into
mainfrom
gwdp/warn-unknown-build-environment

Conversation

@gwdp

@gwdp gwdp commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Why

A workflow job with an environment that doesn't exist (e.g. staging, vs development/preview/production) gets no warning. It silently resolves to zero environment variables and fails later in a confusing, unrelated-looking way (e.g. the app config failing to read).

How

Warn in the "Spin up build environment" phase when the job's environment isn't development/preview/production.

Test Plan

Ran this job against a local worker:

jobs:
  verify_fingerprint_job_outputs:
    name: Verify fingerprint job outputs
    type: custom
    environment: staging
    runs_on: linux-medium
    steps:
      - run: echo "=== test job ==="
Screenshot 2026-07-03 at 4 18 14 PM Screenshot 2026-07-03 at 4 21 17 PM

gwdp commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@gwdp gwdp added the no changelog PR that doesn't require a changelog entry label Jul 3, 2026
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.27%. Comparing base (9247f3c) to head (bf57252).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3952      +/-   ##
==========================================
+ Coverage   59.18%   59.27%   +0.10%     
==========================================
  Files         935      936       +1     
  Lines       41075    41159      +84     
  Branches     8648     8675      +27     
==========================================
+ Hits        24306    24393      +87     
+ Misses      16674    16666       -8     
- Partials       95      100       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gwdp gwdp force-pushed the gwdp/warn-unknown-build-environment branch from 6e5f479 to 284fedd Compare July 3, 2026 23:21
@gwdp gwdp requested a review from sjchmiela July 3, 2026 23:22
@gwdp gwdp force-pushed the gwdp/warn-unknown-build-environment branch from 284fedd to 595d6ba Compare July 3, 2026 23:24
@gwdp gwdp marked this pull request as ready for review July 3, 2026 23:25
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
**/* @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

{ job: omit(ctx.job, 'secrets', 'projectArchive') },
'Builder is ready, starting build'
);
warnOnUnknownEnvironment(ctx);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

started with a new build phase but thought it was overkill and moved here. Let me know if you have any different thoughts

@gwdp gwdp force-pushed the gwdp/warn-unknown-build-environment branch from 595d6ba to 7af22e7 Compare July 3, 2026 23:33
@gwdp gwdp force-pushed the gwdp/warn-unknown-build-environment branch from 7af22e7 to bf57252 Compare July 3, 2026 23:44
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

⏩ The changelog entry check has been skipped since the "no changelog" label is present.


export function warnOnUnknownEnvironment(ctx: EnvironmentWarningContext): void {
const environment = ctx.metadata?.environment;
if (environment && !KNOWN_BUILD_ENVIRONMENTS.includes(environment)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We support custom environments, so specifying a not-known environment is not an issue per se as long as the user has environment variables in that environment?

Initially I thought we might color the environment pill yellow on workflow run page if the environment has no variables, but that would color it yellow if a user does not use EAS Environment Variables at all which is bad?

Maybe we do this ^ but only if environment is not one of the known environments? Or sth like that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog PR that doesn't require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants